#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <string.h>
int main()
{
	char arr[1001] = {0};
	gets(arr);
	int len = strlen(arr);
	int count = 0;
	for (int i = 0;i < len;i++)
	{
		if (arr[i] != ' ' && arr[i + 1] == ' ')
			count++;
	}
	if (arr[len - 1] != ' ')
		count++;
	printf("%d\n", count);
	return 0;
}